/**
 * Created by hank-leihan on 16/11/29.
 */
function index_community(data){

    var time_sub, x_index = '', x_text;
    for (var key in data) {
        for (var pic_num = 0; pic_num < 6; pic_num++) {
            if (data[key].pic[pic_num] != null || data[key].pic[pic_num] != "" || data[key].pic[pic_num] != "null") {
                x_text = '<img src="' + data[key].pic[pic_num] + '" alt="">';
                x_index += x_text;
            } else {
                continue;
            }
        }
        //时间截取
        time_sub = data[key].time.substring(0, 16);

        var dom = '<li onclick="gotohotdetail(\'sub_community_tieba_detail.html\',this)" data-postid="' + data[key].fakeid + '" class="Tieba_list mui-table-view-cell mui-media">' +
            '<a href="javascript:;">' +
            '<img id="listheadurl" class="mui-media-object mui-pull-left" src="' + data[key].headurl + '">' +
            '<div class="mui-media-body">' +
            '<h5 id="listwriter">' + data[key].username + '</h5>' +
            '<h4 id="listtitle">' + data[key].title + '</h4>' +
                //'<p id="summary" class="mui-ellipsis">'+data[key].summary+'</p>' +
            '<div class="mui_body_img">' + x_index + '</div>' +
            '<p><span id="time">' + time_sub + '</span><span id="discuss" class="mui-icon mui-icon-chatbubble mui-pull-right">' + data[key].commentcount + '</span></p>' +
            '</div>' +
            '</a>' +
            '</li>';
        $("#district").append(dom);
        x_index = '';
        x_text = '';
    }

}

function index_community_two(data){
    var time_sub,x_index='',x_text;
    for(var key in data) {
        for(var pic_num = 0;pic_num<6;pic_num++){
            if(data[key].pic[pic_num] != null || data[key].pic[pic_num] != ""){
                x_text='<img src="'+data[key].pic[pic_num]+'" alt="">';
                x_index+=x_text;
            }
        }
        //时间截取
        time_sub = data[key].time.substring(0,16);

        var dom = '<li onclick="gotohotdetail(\'sub_community_tieba_detail.html\',this)" data-postid="'+data[key].fakeid+'" class="Tieba_list mui-table-view-cell mui-media">' +
            '<a href="javascript:;">' +
            '<img id="listheadurl" class="mui-media-object mui-pull-left" src="'+data[key].headurl+'">' +
            '<div class="mui-media-body">' +
            '<h5 id="listwriter">'+data[key].username+'</h5>' +
            '<h4 id="listtitle">'+data[key].title+'</h4>' +
                //'<p id="summary" class="mui-ellipsis">'+data[key].summary+'</p>' +
            '<div class="mui_body_img">'+x_index+'</div>' +
            '<p><span id="time">'+time_sub+'</span><span id="discuss" class="mui-icon mui-icon-chatbubble mui-pull-right">'+data[key].commentcount+'</span></p>' +
            '</div>' +
            '</a>' +
            '</li>';
        $("#district").append(dom);
        x_index = ''; x_text='';
    }
}

gotohotdetail = function(des, obj) {
    mui.openWindow({
        url: des,
        extras: {
            postid: $(obj).data("postid")
        }
    });
};